<?php
    session_start();
	if (isset($_SESSION['username']))		$login = true;
	else		$login = false;

    if (!$login)
    {	
?>
		<div id="loginarea">
        <form action="php/auth.php" method="post">
        	<table id="inputLogin"><tr>
        		<td class="iltext">Username</td><td><input type="text" name="usr"></td>
        	</tr><tr>
        		<td class="iltext">Password</td><td><input type="password" name="pass"></td>
        	</tr><tr>
        	<td></td><td><input type="submit" value="login" /></td>
        	</tr>
        </table>
        </form>
        </div>
<?php
    }
    else
    {
		$loguname = $_SESSION['username'];
		$path = 'users/'.$loguname.'/';
		if (file_exists('user.php')) require_once 'user.php';
		else if (file_exists('php/user.php')) require_once 'php/user.php';
		else require_once '../user.php';	
?>
        <div id="profpicarea">
            <table class="logouttable"><tr>
            <td class="logouttd">
            <?php
                echo '<h1 class="username">'.$loguname.'</h1>';
                echo '<br/>'.user::getNFollower($loguname).' follower, '.user::getNFollowee($loguname).' followee'.'<br/>';
                echo '<a class="logoutButton" href="php/LogOut.php">Log Out</a>'
            ?>
            </td>
            <td style="width:80px">
            <?php
				if (file_exists ('php/photo.php')) require_once 'php/photo.php';
				else if (file_exists ('photo.php')) require_once 'photo.php';
				else require_once '../photo.php';
                
				$list = photo::getProfPic($loguname);
                $row = mysql_fetch_array($list);
                if ($row["FileFoto"] == NULL)
                    echo '<img id="profpic" src = "'.'images/bg-photo.png'.'"/><br/>';
                else
                {
                    echo '<img id="profpic" alt="profpic" src="users/'.$loguname.'/'.$row["FileFoto"].'" />';
                }
            ?>
            </td></tr></table>
        </div>
<?php
    }
?>